home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / utility / v11n04.zip / UPDATE.BAS < prev   
BASIC Source File  |  1991-03-28  |  1KB  |  31 lines

  1. 'UPDATE.BAS - modifies a file's date and time stamp
  2.  
  3. DECLARE SUB UpDate (FileName$, InDate$, InTime$)
  4.  
  5. LINE INPUT "  File to update: ", FileName$
  6. LINE INPUT "Enter a new date: ", NewDate$
  7. LINE INPUT "Enter a new time: ", NewTime$
  8.  
  9. CALL UpDate(FileName$, NewDate$, NewTime$)
  10.  
  11. SUB UpDate (FileName$, InDate$, InTime$) STATIC
  12.  
  13.   DIM Temp AS STRING * 1        'this receives a byte from the file
  14.   FileNumber = FREEFILE         'create a unique file number
  15.  
  16.   OPEN FileName$ FOR BINARY AS #FileNumber LEN = 1
  17.   GET #FileNumber, 1, Temp$     'get a byte then put a byte
  18.   PUT #FileNumber, 1, Temp$     'now the file appears to be changed
  19.  
  20.   SaveDate$ = DATE$             'save the current system date and time
  21.   SaveTime$ = TIME$
  22.   DATE$ = InDate$               'set a new date and time
  23.   TIME$ = InTime$
  24.   CLOSE #FileNumber             'tell DOS to update the file's info
  25.  
  26.   DATE$ = SaveDate$             'restore the original date and time
  27.   TIME$ = SaveTime$
  28.  
  29. END SUB
  30.  
  31.